<!--
 * @LastEditors: 杜康
 * @LastEditTime: 2021-09-15 17:38:49
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-if的render实现方式</title>
</head>

<body>
  <div id="app">
    <ele :show="show" />
  </div>
  <script src="https://unpkg.com/vue/dist/vue.min.js"></script>
  <script>
    Vue.component('ele', {
      props: {
        show: {
          type: Boolean,
          default: false
        }
      },
      render: function (createElement) {
        if (this.show) {
          return createElement('p', [
            createElement('p', '第一列'),
            createElement('p', '第二列，show的值为true')
          ])
        } else {
          return createElement('p', 'show的值为false')
        }
      }
    })

    var app = new Vue({
      el: '#app',
      data: {
        show: true
      }
    })
  </script>
</body>

</html>